package interfaces

import (
	"gitee.com/captials-team/ubdframe/src/domain/dto"
	"gitee.com/captials-team/ubdframe/src/domain/dto/respdata"
	"github.com/gin-gonic/gin"
)

type ItfResponseController interface {
	Response(ctx *gin.Context, data respdata.ResponseData, msgData ...map[string]string)
	ResponseCode(ctx *gin.Context, code int, data respdata.ResponseData, msgData ...map[string]string)
}

// ItfCaptchaController 图片验证码相关
type ItfCaptchaController interface {
	GetCaptcha(ctx *gin.Context)
	VerifyCaptcha(ctx *gin.Context)

	VerifyHandler() gin.HandlerFunc //验证handler，用于中间件
}

// ItfVerifyCodeController 发送验证码相关
type ItfVerifyCodeController interface {
	SendCode(ctx *gin.Context)
	VerifyCode(ctx *gin.Context)

	VerifyHandler() gin.HandlerFunc //验证handler，用于中间件
}

// ItfBaseDataController 基本数据
type ItfBaseDataController interface {
	Regions(ctx *gin.Context)
}

// ItfUserCenterController 用户中心模块
type ItfUserCenterController interface {
	UserInfo(ctx *gin.Context)       //用户信息（比 AuthController的 AuthInfo 信息更多）
	ResetPassword(ctx *gin.Context)  //重置密码
	BindEmailPhone(ctx *gin.Context) //绑定邮箱
	LoginRecord(ctx *gin.Context)    //登录记录
	ModifyInfo(ctx *gin.Context)     //修改个人信息
	ModifyPassword(ctx *gin.Context) //修改密码
}

type ItfAdminCenterController ItfUserCenterController

// ItfUserAuthController 用户授权模块
type ItfUserAuthController interface {
	ItfAuthController

	SignUp(ctx *gin.Context)       //注册
	AuthByWxCode(ctx *gin.Context) //微信登录
	AuthByQQ(ctx *gin.Context)     //QQ登录

	//debug用
	DebugAuthByThird(ctx *gin.Context)
}

// ItfAdminAuthController 管理站授权模块
type ItfAdminAuthController interface {
	ItfAuthController
}

// ItfAuthController 通用授权模块
type ItfAuthController interface {
	AuthLogin(ctx *gin.Context)  //登录
	AuthLogout(ctx *gin.Context) //登出

	AuthCheck(ctx *gin.Context)      //校验登录状态
	AuthInfo(ctx *gin.Context)       //获取认证信息
	AuthFreshToken(ctx *gin.Context) //token刷新
}

// ItfAdminManageController 管理员管理
type ItfAdminManageController interface {
	SearchAdmin(ctx *gin.Context)
	QueryAdmin(ctx *gin.Context)
	SaveAdmin(ctx *gin.Context)
	DisableAdmin(ctx *gin.Context)
	DeleteAdmin(ctx *gin.Context)
}

// ItfAdminLogController 管理员日志管理
type ItfAdminLogController interface {
	SearchAdminLog(ctx *gin.Context)

	LogHandler() gin.HandlerFunc //日志记录的handler
}

type ItfAccreditController interface {
	AccreditInfo(ctx *gin.Context) //权限信息

	CheckAccreditHandler() gin.HandlerFunc //权限检查校验的handler
	Permissions() []*dto.PermissionItem
}

// ItfRbacManageController RBAC管理
type ItfRbacManageController interface {
	//用户与角色绑定关系维护
	SearchUserRoles(ctx *gin.Context) //用户绑定roles列表搜索
	BindUserRoles(ctx *gin.Context)   //用户绑定roles操作

	//角色管理
	SearchRoles(ctx *gin.Context)
	SimpleRoles(ctx *gin.Context)
	QueryRole(ctx *gin.Context)
	SaveRole(ctx *gin.Context)
	DisableRole(ctx *gin.Context)
	DeleteRole(ctx *gin.Context)

	//角色和权限绑定关系维护
	SearchRolePermissions(ctx *gin.Context)
	SaveRolePermissions(ctx *gin.Context)

	//权限管理
	SearchPermissions(ctx *gin.Context)
	DeletePermission(ctx *gin.Context)
	SavePermission(ctx *gin.Context)
}

// ItfUserManageController 用户管理
type ItfUserManageController interface {
	SearchUser(ctx *gin.Context)
	QueryUser(ctx *gin.Context)
	SaveUser(ctx *gin.Context)
	DeleteUser(ctx *gin.Context)
	DisableUser(ctx *gin.Context)
	ResetUserPassword(ctx *gin.Context)
}

type ItfOssController interface {
	DoUpload(ctx *gin.Context)  //上传操作
	ConfigOss(ctx *gin.Context) //配置oss
}

type ItfSettingController interface {
	GetSetting(ctx *gin.Context)
	PutSetting(ctx *gin.Context)
	GetMultiSetting(ctx *gin.Context)
	PutMultiSetting(ctx *gin.Context)
}

type ItfTelemetryController interface {
	GetLatest(ctx *gin.Context)
	SearchHistory(ctx *gin.Context)
	SearchStats(ctx *gin.Context)
}

// ItfBlockContentController 块内容控制器
type ItfBlockContentController interface {
	SearchBlock(ctx *gin.Context)
	QueryBlock(ctx *gin.Context)
	SaveBlock(ctx *gin.Context)
	DeleteBlock(ctx *gin.Context)
	DisableBlock(ctx *gin.Context)
}

type ItfJobController interface {
	SearchJobs(ctx *gin.Context)
	//QueryJob(ctx *gin.Context)
	//JobTypes(ctx *gin.Context)
}

type ItfOrganizeManageController interface {
	SearchOrganize(ctx *gin.Context)  //组织列表
	TreeOrganize(ctx *gin.Context)    //组织树返回
	QueryOrganize(ctx *gin.Context)   //查询详情
	SaveOrganize(ctx *gin.Context)    //保存组织
	DisableOrganize(ctx *gin.Context) //启用/禁用组织
	DeleteOrganize(ctx *gin.Context)  //删除组织
}

type ItfRssController interface {
	RssCacheItems(ctx *gin.Context)
}

type ItfRssManageController interface {
	RssSourceList(ctx *gin.Context)  //rss源列表
	RssSourceItems(ctx *gin.Context) //rss内容列表
}
